package days48;

import java.util.Scanner;

public class day21 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String str1=scanner.nextLine();
        String str2=scanner.nextLine();
        int max=0;
        int[][] arr=new int[str1.length()+1][str2.length()+1];
        for (int i = 0; i < str1.length();i++) {
            for (int j = 0; j < str2.length(); j++) {
                if(str1.charAt(i)==str2.charAt(j)){
                    arr[i+1][j+1]=arr[i][j]+1;
                }
                if (arr[i+1][j+1]>max){
                 max=arr[i+1][j+1];
                }
            }
        }
        System.out.println(max);
    }
    public static void main1(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String str=scanner.nextLine();
        for (int i = 0; i < str.length(); i++) {
            System.out.println(str.charAt(str.length()-1-i));
        }
    }
}
